package com.chinasofti.project.web;

import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.chinasofti.project.common.CreateCaptchaImgUtils;
import com.chinasofti.project.common.RandomUtils;
import com.chinasofti.project.web.common.ControllerBase;

@Controller
public class JumpController extends ControllerBase {

	@RequestMapping("createCaptcha")
	public void createCaptcha(HttpServletResponse response, HttpSession session) {
		// 生成随机验证码
		String captchaCode = RandomUtils.randomString(4);
		// 将验证码输出成图片
		BufferedImage img = CreateCaptchaImgUtils.createCaptchaImg(captchaCode);
		// 放入session便于后续校验
		session.setAttribute("sessionCaptcha", captchaCode);
		// 写入响应
		response.setHeader("Pragma", "No-cache");
		response.setHeader("Cache-Control", "no-cache");
		response.setDateHeader("Expires", 0);
		try {
			ImageIO.write(img, "PNG", response.getOutputStream());
		} catch (IOException e) {
			e.printStackTrace();
			throw new RuntimeException("验证码生成失败");
		}
	}

	@RequestMapping("toLogin")
	public String toLogin() {
		return "login";
	}

	@RequestMapping("toBreezeArticle1")
	private String toBreezeArticle1() {
		return "temp_article/breeze_article1";
	}

	@RequestMapping("toBreezeArticle2")
	private String toBreezeArticle2() {
		return "temp_article/breeze_article2";
	}

	@RequestMapping("toBreezeArticle3")
	private String toBreezeArticle3() {
		return "temp_article/breeze_article3";
	}

	@RequestMapping("toBreezeArticle4")
	private String toBreezeArticle4() {
		return "temp_article/breeze_article4";
	}

	@RequestMapping("toBreezeArticle5")
	private String toBreezeArticle5() {
		return "temp_article/breeze_article5";
	}

	@RequestMapping("toBreezeArticle6")
	private String toBreezeArticle6() {
		return "temp_article/breeze_article6";
	}

	@RequestMapping("toBreezeArticle7")
	private String toBreezeArticle7() {
		return "temp_article/breeze_article7";
	}

	@RequestMapping("toBreezeArticle8")
	private String toBreezeArticle8() {
		return "temp_article/breeze_article8";
	}

	@RequestMapping("toBreezeArticle10")
	private String toBreezeArticle10() {
		return "temp_article/breeze_article10";
	}

	@RequestMapping("toBreezeArticle11")
	private String toBreezeArticle11() {
		return "temp_article/breeze_article11";
	}

	@RequestMapping("toBreezeArticle12")
	private String toBreezeArticle12() {
		return "temp_article/breeze_article12";
	}

	@RequestMapping("toAgentLevel")
	private String toAgentLevel() {
		return "temp_article/agent_level";
	}

	@RequestMapping("toClassRoom")
	private String toClassRoom() {
		return "temp_article/class_room";
	}

	@RequestMapping("toBreezeAbout")
	private String toBreezeAbout() {
		return "temp_article/breeze_about";
	}

	@RequestMapping("toBreezeIntegral")
	private String toBreezeIntegral() {
		return "breeze_integral";
	}

	@RequestMapping("toBreezeCoupon")
	private String toBreezeCoupon() {
		return "breeze_coupon";
	}

	@RequestMapping("toBreezeMailQuery")
	private String toBreezeMailQuery() {
		return "breeze_mail_query";
	}

	@RequestMapping("toBreezePaypwdModify")
	private String toBreezePaypwdModify() {
		return "breeze_paypwd_modify";
	}

	@RequestMapping("toBreezeRefund")
	private String toBreezeRefund() {
		return "breeze_refund";
	}

	@RequestMapping("toBreezeWelcome")
	private String toBreezeWelcome() {
		return "breeze_welcome";
	}

	@RequestMapping("toIssues")
	private String toIssues() {
		return "issues";
	}

	@RequestMapping("toEnterpriseId")
	private String toEnterpriseId() {
		return "enterprise_id";
	}

	@RequestMapping("toBreezeContract")
	private String toBreezeContract() {
		return "breeze_contract";
	}

	@RequestMapping("toItemRemove")
	private String toItemRemove() {
		return "item_remove";
	}

	@RequestMapping("toBreezeModifypayStep1")
	private String toBreezeModifypayStep1() {
		return "breeze_modifypay_step1";
	}

	@RequestMapping("toBreezeModifypayStep2")
	private String toBreezeModifypayStep2() {
		return "breeze_modifypay_step2";
	}

	@RequestMapping("toBreezeModifypayStep3")
	private String toBreezeModifypayStep3() {
		return "breeze_modifypay_step3";
	}

	@RequestMapping("toBreezeMessage")
	private String toBreezeMessage() {
		return "breeze_message";
	}

	@RequestMapping("toBreezeApplyReturn")
	private String toBreezeApplyReturn() {
		return "breeze_apply_return";
	}

	@RequestMapping("toBreezeOrderDetail")
	private String toBreezeOrderDetail() {
		return "breeze_order_detail";
	}

	@RequestMapping("toBreezeOrderReceipted")
	private String toBreezeOrderReceipted() {
		return "breeze_order_receipted";
	}

}